<script setup lang="ts">
import {onMounted, ref} from 'vue'
import ChildComp from './components/ChildComp.vue'

// 看子组件的类型
const childRef = ref<InstanceType<typeof ChildComp>>()

onMounted(() => {
    // console.log(childRef.value);
    // console.log(childRef.value?.car);
    childRef.value?.logCar()
    
    
})
</script>

<template>
    <div class="aa">
        <div>父组件</div>
        <!-- 3. 父组件传递数据给子组件 -->
        <ChildComp ref="childRef" />
    </div>

</template>

<style lang="css" scoped>

.aa{
    width: 600px;
    height: 300px;
    background-color: violet;
}
</style>
